package com.mxp.influx.client;

import com.mxp.influx.client.utils.PublicUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

import javax.annotation.PostConstruct;
import java.io.IOException;

@Slf4j
@EnableScheduling
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    /**
     * 获取sqlite路径
     */
    @Value("${sqlite.filepath}")
    private String sqliteFilepath;

    /**
     * 初始化并创建sqlite文件
     * @throws IOException
     */
    @PostConstruct
    public void initSqlite() throws IOException {
        PublicUtil.createFile(sqliteFilepath);
    }
}
